<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$site_config.0.value} - 登录</title>
    <meta name="keywords" content="{$site_config.3.value}">
    <meta name="description" content="{$site_config.4.value}">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__STATIC__/hui/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/hui/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__STATIC__/hui/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/hui/css/style.css?v=4.1.0" rel="stylesheet">
    <!--layui-->
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css">
    <script src="__STATIC__/layui/layui.js"></script>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>
<body>
    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>
                <h1 class="logo-name">智+</h1>
            </div>
            <h3>欢迎使用 {$site_config.0.value}</h3>
            <!--form元素开始-->
            <div class="m-t ibox-content layui-form">
                <div class="form-group">
                    <input type="text" name="username" required  lay-verify="required" autocomplete="off" class="form-control" placeholder="用户名">
                </div>
                <div class="form-group">
                    <input type="password" name="password" required  lay-verify="required" autocomplete="off" class="form-control" placeholder="密码">
                </div>
                <div class="form-group">
                    <input type="text" name="code" required  lay-verify="required" autocomplete="off" class="form-control" placeholder="点击图片刷新验证码">
                </div>
                <div class="form-group">
                    <img src="{:captcha_src()}" onclick="javascript:this.src='{:captcha_src()}?tm='+Math.random()"  style="width: 260px; height: 50px;margin-top: 10px;" />
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b" lay-submit="" lay-filter="component-form-element-login">登 录</button>
                <p class="text-muted text-center">
                    <a id="forget">
                        <small>忘记密码了？</small>
                    </a> |
                    <a id="register">
                        <small>注册一个新账号</small>
                    </a>
                </p>
            </div>
            <!--form元素结束-->
        </div>
    </div>
    <!-- 全局js -->
    <script src="__STATIC__/hui/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/hui/js/bootstrap.min.js?v=3.3.6"></script>
    <script>
        //Demo
        layui.use('form', function(){
            var form = layui.form;
            //监听提交
            form.on('submit(component-form-element-login)', function (data) {
                //$('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
                $.ajax({
                    url:"{:url('admin/login/index')}",
                    type:'post',
                    dataType:'json',
                    data:data.field,
                    success:function(res){
                        if (res.data == 1) {
                            layer.msg(res.message);
                            setTimeout(window.location.href=res.message,2000);
                        } else if (res.data == 0) {
                            layer.open({
                                title: '登录失败'
                                ,content: res.message
                            });
                        } else {
                            layer.open({
                                title: '登录失败'
                                ,content: '出现未知错误，如果问题一直出现，您可以联系管理员'
                            });
                        }
                    },error:function () {
                        layer.open({
                            title: '登录失败'
                            ,content: '当前网络环境不安全，拒绝登录，请调整网络环境'
                        });
                    }
                })
            });
        });
    </script>
    <script>
        layui.use('layer', function(){
            var layer = layui.layer;
        });
    </script>
    <script>
        /*处理用户登录相关问题*/
        $(document).on('click','#forget',function(){
            layer.open({
                title: '忘记密码'
                ,content: '{$alert_config.0.value}'
            });
        });
        $(document).on('click','#register',function(){
            layer.open({
                title: '注册账号'
                ,content: '{$alert_config.1.value}'
            });
        });
    </script>
</body>

</html>
